from twisted.internet import reactor
from txjsonrpc.web.jsonrpc import Proxy
 
def printValue(value):
    print "Result is " + str(value)
 
def printError(error):
    print 'Error', error
 
def stopReactor(data):
    print "Stopping reactor..."
    reactor.stop()
 
proxy = Proxy('http://127.0.0.1:7090/')
d = proxy.callRemote('add', 3, 5)
d.addCallback(printValue).addErrback(printError)
d = proxy.callRemote('mult', 2, 5)
d.addCallback(printValue).addErrback(printError).addBoth(stopReactor)
reactor.run()
